#!/usr/bin/env python
#coding=utf-8

import difflib

text1 = """text1:
This module provides class and functions for comparing sequences.
including HTML and context and unified diffs.
difflib document v7.4
add string
"""

text1_line = text1.splitlines()
text2 = """text2:
This module provides class and functions for Comparing sequences.
including HTML and context and unified diffs.
difflib document v7.5
add string
"""

text2_line = text2.splitlines()
d = difflib.Differ()
diff = d.compare(text1_line, text2_line)
print '\n'.join(list(diff))

d2 = difflib.HtmlDiff()
diffHTML = d2.make_file(text1_line, text2_line)
f = open('./diff.html', 'a+w')
f.write(diffHTML)
f.close()